<?php /*a:1:{s:35:"E:\project\tp\view\login\index.html";i:1621163620;}*/ ?>

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title><?php echo htmlentities($title); ?></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="/static/layui/css/layui.css"/>

    </head>
    <body>
        <div class="layui-container" style="margin-top: 160px">
            <div class="layui-row">

                <form id="login" class="layui-form layui-col-md4 layui-col-md-offset4" >

                    <div class="layui-form-item">
                        <label class="layui-form-label">用户名</label>
                        <div class="layui-input-block">
                            <input  type="text" name="admin_name" lay-verify="required" autocomplete="off"lay-reqtext="必须输入用户名" placeholder="请输入用户名" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-block">
                            <input type="password" name="password" lay-verify="required" lay-reqtext="必须输入密码" placeholder="请输入密码" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">验证码</label>

                        <div class=" layui-col-md3">
                            <input  type="text" name="code" lay-verify="required" lay-reqtext="必须输入验证码" placeholder="请输入验证码" autocomplete="off" class="layui-input">

                        </div>
                        <img class="layui-col-md5" onclick="this.src = this.src + '?k=' + Math.random();" style="float:right" src="<?php echo url('login/verify'); ?>" alt="captcha" />
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button id="btn_login" type="button" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>


            </div>
        </div>    
        <script src="/static/layui/layui.js"></script>
        <script>
                            layui.use(['layer'], function () {
                                var layer = layui.layer;
                                var $ = layui.jquery
                                $(' #btn_login').on('click', function () {
                                    


                                    $.ajax({
                                                    url: '/Login/loginUp',
                                                    type: 'POST',
                                                    data: $('#login').serialize(),
                                                    dataType: "json",

                                                    success: function (data) {

                                                            if (data) {
                                                                    layer.msg(data['msg'],"",3000);
                                                                        if (data['code']==3){
                                                                            window.location.href='/admin';
                                                                        }
                                                            }
                                                            else {
                                                                    layer.alert("提交失败！")
                                                            }
                                                    },
                                                    error: function (e) {
//                                layer.alert("提交失败！")
                                                    },
                                                            
            
                                            });

                                });


                            })

        </script>
    </body>
</html>
